<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Todo List</title>
    <script src="../vue.js"></script>
  </head>
  <body>
    <div id="app">{{ fullName }}</div>
    <script>
      var app = new Vue({
        el: '#app',
        data: {
          firstName: 'Enxiao',
          lastName: 'Zhao'
        },
        computed: {
          fullName: {
            get: function() {
              return this.firstName + ' ' + this.lastName
            },
            set: function(newName,oldName) {
              console.log('newName:',newName)
              console.log('oldName:',oldName)
              var arr = fullName.split(' ')
              this.firstName = arr[0]
              this.lastName = arr[1]
            }
          }
        }
      })
    </script>
  </body>
</html>
